//****************************************/
//* mElements  12 2011                   */
//* Riku Maikola rpm@ac-mapa.org         */
//****************************************/
#include "../mElements.h"

mPoint eTriangle::p1()
{
    return at(0);
};
mPoint eTriangle::p2()
{
    return at(1);
};
mPoint eTriangle::p3()
{
    return at(2);
};
//********************************************************************************************************//
//**                //\\    element boxing  13.12.2012
//**               //__\\
//**              //    \\
//********************************************************************************************************//
void eTriangle::cArea()
{
    ClearArea();

    test(p1());
    test(p2());
    test(p3());
}
//************************************************************************************************//
//**                                                                                            **//
//**                        INTERSECTION                                                        **//
//**                                                                                            **//
//************************************************************************************************//
/*
bool eRay::Intersection(mPointArray *A ,eLine line)
{
    return line.Intersection(A,eR(p1(),p2()));
}
bool eRay::Intersection(mPointArray *A ,eArc arc)
{
    return arc.Intersection(A,eR(p1(),p2()));
}
bool eRay::Intersection(mPointArray *A ,eCircle circle)
{
    return circle.Intersection(A,eR(p1(),p2()));
}
bool eRay::Intersection(mPointArray *A ,eRay Ray)
{
    double A1 = p2().y-p1().y;
    double B1 = p1().x-p2().x;
    double C1 = A1*p1().x+B1*p1().y;

    double A2 = Ray.p2().y-Ray.p1().y;
    double B2 = Ray.p1().x-Ray.p2().x;
    double C2 = A2*Ray.p1().x+B2*Ray.p1().y;

    double det = (A1*B2) - (A2*B1);

    if(AER(det,0))
    {
    }
    else
    {
        A->Add(mP((B2*C1 - B1*C2)/det , (A1*C2 - A2*C1)/det,0) ,true );
        return true;
    }
    return false;
}
*/
//************************************************************************************************//
//**                                                                                            **//
//**                        GLOBAL..                                                            **//
//**                                                                                            **//
//************************************************************************************************//
eTriangle eT(mPoint p1,mPoint p2,mPoint p3,wxString L)
{
    eTriangle tri;
//    tri.layer=L;
    tri.r = 0;
    tri.a1 = 0;
    tri.a2 = 0;
    tri.push_back( p1 );
    tri.push_back( p2 );
    tri.push_back( p3 );
    tri.cArea();
    return tri;
}
